package com.wd.tech.view.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.wd.tech.R;
import com.wd.tech.bean.BiaotiSerchBean;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SuoAdapter extends RecyclerView.Adapter<SuoAdapter.VH> {



    private Context context;

    List<BiaotiSerchBean.ResultBean> list;

    public SuoAdapter(Context context, List<BiaotiSerchBean.ResultBean> list) {
        this.context = context;
        this.list = list;
    }


    @NonNull
    @Override
    public VH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {

        View inflate = View.inflate(context, R.layout.xian, null);

        VH vh = new VH(inflate);

        return vh;

    }

    @Override
    public void onBindViewHolder(@NonNull VH holder, int position) {

        holder.t1.setText(list.get(position).getTitle());

        holder.t2.setText(list.get(position).getSource());
    }


    @Override
    public int getItemCount() {
        return list.size();
    }

    class VH extends RecyclerView.ViewHolder {

        private final TextView t1,t2;

        public VH(@NonNull View itemView) {
            super(itemView);

             t1 = itemView.findViewById(R.id.t1);
             t2 = itemView.findViewById(R.id.t2);
        }
    }

}
